package com.hgyc.mom.wms.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hgyc.mom.common.vo.Result;
import com.hgyc.mom.core.mybatis.QueryWrapperUtil;
import com.hgyc.mom.wms.entity.WmsStockInDetail;
import com.hgyc.mom.wms.service.WmsStockInDetailService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 入库单明细Controller
 *
 * @author fwj
 * @since 2025-10-08
 */
@Tag(name = "入库单明细控制器", description = "入库单明细控制器")
@RestController
@RequestMapping("/wms/stockIn/detail")
public class WmsStockInDetailController {
    @Autowired
    private WmsStockInDetailService wmsStockInDetailService;


    @Operation(summary = "查询入库单明细树列表", description = "查询入库单明细树列表")
    @PostMapping("/list")
    public Result<List<WmsStockInDetail>> pageList(@Parameter(description = "查询参数") @RequestBody WmsStockInDetail wmsStockInDetail) {
        QueryWrapper<WmsStockInDetail> wrapper = QueryWrapperUtil.build(wmsStockInDetail);
        List<WmsStockInDetail> list = wmsStockInDetailService.list(wrapper);
        return Result.success(list);
    }

    @Operation(summary = "获取入库单明细详细信息", description = "获取入库单明细详细信息")
    @GetMapping(value = "/{id}")
    public Result<WmsStockInDetail> getInfo(@Parameter(description = "入库单明细ID") @PathVariable("id") Long id) {
        return Result.success(wmsStockInDetailService.getById(id));
    }

}
